<template>
  <h1>新闻页</h1>
  <h1>$route.params.nid:{{ $route.params.nid }}</h1>
</template>

<script>
export default {
  data() {
    return {};
  },
  mounted() {
    console.log(this.$route);
    // params: {id: '123'}
    // path: "/news/123"
  },

  // 组件内使用的路由守卫
  beforeRouteEnter(to, from, next) {
    // ...
    console.log("路由进入");
    next();
  },
  beforeRouteLeave(to, from, next) {
    // ...
    console.log("路由离开");
    next();
  },
  beforeRouteUpdate(to, from, next) {
    console.log("路由更新");
    next();
  },
};
</script>
